package com.bugu.dao.customer;

import org.springframework.stereotype.Repository;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.hibernate.HibernateDao;

import com.bugu.entity.customer.Company;
/**
 * Dao 解耦
 * @author bugu
 *
 */
@Repository
public class CompanyDao extends HibernateDao<Company, Long> {
	/*
	 * 写完 才发现，ss3已经实现了,不过如果返回page还必须改写springside
	 * 所以索性用自己的实现了
	 */
	private final String QUERY_COMPANY_BY_USER 
		= "select company from Company company join company.user as user where user.loginName=?"; 
	public Page<Company> findByUser(Page<Company> page,String name){
		page = find(page,QUERY_COMPANY_BY_USER,name);
		return page;
	}
	

}
